#ifndef INTERFACE_H
#define INTERFACE_H
#endif // INTERFACE_H

#include <QtDebug>
#include<QObject>
#include <QGLViewer/qglviewer.h>
#include<opencv2/opencv.hpp>
 #include <QThread>
#include <qtconcurrentrun.h>

using namespace cv;
 using namespace QtConcurrent;

class Viewer : public QGLViewer
{
    Q_OBJECT

public :
    Viewer(QWidget *parent);


public slots:
    void loadResultFile();

    void animSpeedChanged(int speed);

private :
    Mat points0,points1; //points to be read
    Mat triangles; //triangles to be read
    int timeCode; //time code to be read

    bool points0loaded,points1loaded,trianglesLoaded;

    int animSpeed,animTime;

    void loadResultFile_real();
    void drawTubes();

public :
    QString dataFile0,dataFile1; //data files to read
    QString triangleFileName;  //triangle data file

    FileStorage fs, fs1, fsTriangles;
    FileNode frames,frames1,framesTriangles;
    FileNodeIterator it, it_begin, it_end,
                     it1, it_begin1, it_end1,
                     itTriangles, itTrianglesBegin, itTrianglesEnd;

    bool showCam0,showCam1;  //if true the data from the camera will be shown
    bool showTankGeom;
    bool showTriangles;
    bool showTubing;


protected :
    virtual void draw();
    virtual QString helpString() const;
    virtual void init();
    virtual void animate();

signals:
    void currentPosition(int);
    void readingDataSignal();
    void dataDoneSignal();
    void currentTimecode(int);

};
